import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import {discardPeriodicTasks} from "@angular/core/testing";

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
  constructor(
    private router: Router,
    private activatedRoute: ActivatedRoute,
  ) {
  }
  isCollapsed = false;
  array = ['../image/index1', '../image/index2'];
  isLogin: boolean = false;

  ngOnInit(): void {
    this.router.events.subscribe((data: NavigationEnd) => {

      if (!(data instanceof NavigationEnd)) return false;

      let isLogin = false;
      if (data.urlAfterRedirects === '/login' || data.urlAfterRedirects === '/register') {
        isLogin = true;
      }

      this.isLogin = isLogin;
    })
  }
}
